Log structured storage systems have been developed as a form of disk storage management to improve disk access time. Log structured file systems use the assumption that files are cached in a main memory and that increasing memory sizes will make the caches more effective at responding to read requests. As a result, disk use is dominated by writes. A log structured file system writes all new information to disk in a sequential structure call a log. New information is stored at the end of the log rather than updated in place, to reduce disk seek activity. As information is updated, portions of data records at intermediate locations of the log become outdated. This approach increases write performance by eliminating almost all seeks. The sequential nature of the log also permits faster crash recovery.
Some file systems incorporate the use of logging as an auxiliary structure to speed up writes and crash recovery by using the log only for temporary storage; the permanent home for information is in a traditional random access storage structure on disk.
In a log structured file system, data is stored permanently in the log and there is no other structure on disk. The log contains indexing information so that files can be read back with efficiency. Initially all the free space is in a single extent on disk but by the time the log reaches the end of the disk the free space will have been fragmented into many small extents corresponding to the files that were deleted or overwritten. For a log structured file system to operate efficiently, it must ensure that there are always large extents of free space available for writing new data. In order to maintain large free areas on disk for fast writing, the log is divided into “segments” and a process called free space collection is used to compress the live information from fragmented segments.
Log structured file systems are described in “The Design and Implementation of a Log Structured File System” by M. Rosenblum and J. K. Ousterhout, ACM Transactions on Computer Systems, Vol. 10 No. 1, February 1992, pages 26-52.
Log structured disks (LSD) and log structured arrays (LSA) are disk architectures which use the same approach as the log structured file systems (LFS). The present invention applies equally to all forms of log structured storage systems including LSD, LSA and LSF systems.
A log structured array (LSA) has been developed based on the log structured file system approach but is executed in an outboard disk controller. Log structured arrays combine the log structured file system architecture and a disk array architecture such as the well-known RAID (redundant arrays of inexpensive disks) architecture with a parity technique to improve reliability and availability. RAID architecture is described in “A Case for Redundant Arrays of Inexpensive Disks (RAID)”, Report No. UCBICSD 87/391, December 1987, Computer Sciences Division, University of California, Berkeley, Calif. “A Performance Comparison of RAID 5 and Log Structured Arrays”, Proceedings of the Fourth IEEE International Symposium on High Performance Distributed Computing, 1995, pages 167-178 gives a comparison between LSA and RAID 5 architectures.
An LSA consists of a disk controller and N+1 physical disks. In an LSA, data is stored on disks in compressed form. After a piece of data is updated, it may not compress as well as it did before it was updated, so it may not fit back into the space that had been allocated for it before the update. The implication is that there can no longer be fixed, static locations for all the data. An LSA controller manages information storage to write updated data into new disk locations rather than writing new data in place. Therefore, the LSA must keep a directory which it uses to locate data items in the array.
As an illustration of the N+1 physical disks, an LSA can be considered as consisting of a group of disk drive DASDS, each of which includes multiple disk platters stacked into a column. Each disk is divided into large consecutive areas called segment-columns. A segment-column is typically as large as a physical cylinder on a physical disk. Corresponding segment-columns from the N+1 disks constitute a segment. The array has as many segments as there are segment-columns on a disk in the array. One of the segment-columns of a segment contains the parity (exclusive-OR) of the remaining segment-columns of the segment. For performance reasons, the parity segment-columns are not all on the same disk, but are rotated among the disks.
Logical devices are mapped and stored in the LSA. A logical track is stored, as a set of compressed records, entirely within some segment-column of some physical disk of the array; many logical tracks can be stored in the same segment-column. The location of a logical track in an LSA changes over time. A directory, called the LSA directory, indicates the current location of each logical track. The entire LSA directory is maintained in Non-Volatile Storage (NVS) in the disk controller, to avoid disk accesses when searching the directory.
Whether an LSA stores information according to a variable length format such as a count-key-data (CKD) architecture or according to a fixed block architecture, the LSA storage format of segment-columns is mapped onto the physical storage space in the disk drive units so that a logical track of the LSA is stored entirely within a single segment-column mapped onto a disk drive unit of the array. The size of a logical track is such that many logical tracks can be stored in the same LSA segment-column.
Reading and writing into an LSA occurs under management of the LSA controller. An LSA controller can include resident microcode that emulates logical devices such as direct access storage device (DASD) disk drives, or tape drives. In this way, the physical nature of the external storage subsystem can be transparent to the operating system and to the applications executing on the computer processor accessing the LSA. Thus, read and write commands sent by the computer processor to the external information storage system would be interpreted by the LSA controller and mapped to the appropriate disk storage locations in a manner not known to the computer processor. This comprises a mapping of the LSA logical devices onto the actual disks of the LSA.
A write received from the host system is first written into a non-volatile cache and the host is immediately notified that the write is done. The fraction of cache occupied by modified tracks is monitored by the controller. When this fraction exceeds some threshold, some number of modified tracks are moved (logically) to a memory segment, from where they get written (destaged) to disk. The memory segment is a section of controller memory, logically organized as N+1 segment-columns called memory segment-columns; N data memory segment-columns and 1 parity memory segment-column. When all or part of a logical track is selected from the NVS, the entire logical track is written into one of the N data memory segment-columns. When all data memory segment-columns are full, an XOR operation is applied to all the data memory segment-columns to create the parity memory segment-column, then all N+1 memory segment-columns are written to an empty segment on the disk array.
All logical tracks that were just written to disk from the memory segment must have their entries in the LSA directory updated to reflect their new disk locations. If these logical tracks had been written before by the system, the LSA directory would have contained their previous physical disk locations; otherwise the LSA directory would have indicated that the logical track had never been written, so has no address. Note that writing to the disk is more efficient in LSA than in RAID-5, where 4 disk accesses are needed for an update.
In all forms of log structured storage systems including the described log structured arrays (LSAs) and log structured file systems (LSFs), data to be written is grouped together into relatively large blocks (the segments) which are written out as a unit in a convenient free segment location on disk. When data is written, the previous disk locations of the data become free creating “holes” of unused data (or garbage)-in the segments on disk. Eventually the disk fills up with segments and it is necessary to create free segment locations by reading source segments with holes and compacting their still-in-use content into a lesser number of destination segments without holes. This process is called free space or garbage collection.
To ensure that there is always an empty segment to write to, the free space segments must be collected in the background. All logical tracks from a segment selected for free space collection that are still in that segment are read from disk and placed in a memory segment. In an LSA, they may be placed in the same memory segment used for destaging logical tracks written by the system, or they may be placed in a different memory segment or temporary storage buffer of their own. In any case, these logical tracks will be written back to disk when the memory segment fills. Free space collected segments are returned to the empty segment pool and are available when needed.
As free space collection proceeds, live data from the various target segments is read into the temporary storage buffer, the buffer fills up, and the live data is stored back into an empty segment of the disk array. After the live data in the temporary storage buffer is written back into the disk array, the segments from which the live data values were read are designated as being empty. In this way, live data is consolidated into a fewer number of completely full segments and new empty segments are created. Typically, free space collection is performed when the number of empty segments in the array drops below a predetermined threshold value.
The way in which target segments are selected for the free space collection process affects the efficiency of the operation of the log structured storage system. Three algorithms are used in the prior art, one called the “greedy” algorithm, one called the “cost-benefit” algorithm and one called “age-threshold” algorithm. The greedy algorithm selects target segments by determining how much free space will be achieved for each segment processed and then processes segments in the order that will yield the most amount of free space. The cost-benefit algorithm compares a cost associated with processing each segment against a benefit and selects segments for processing based on the best comparisons. The age-threshold algorithm selects segments for processing only if their age in the information storage system exceeds an age-threshold value and once past the age-threshold, the segments are selected in the order of least utilised segments first.
More particularly, the greedy algorithm selects segments with the smallest utilization first and moves the live tracks from partially filled segments to a target segment in a pool of empty segments. There are two problems with greedy selection: first, segments which are emptying quickly (call “hot” segments) will get collected when it might be more beneficial to leave them a little longer until they contain less still-in-use data; secondly, segments which are nearly full and are emptying extremely slowly or not at all (called “frozen” segments) may tie up free space for a long time (or indefinitely) before they are collected when it might be beneficial to reclaim that free space earlier.
In “The Design and Implementation of a Log-Structured File System” M. Rosenblum and J. K. Ousterhout, ACM Transactions on Computer Systems, Vol. 10 No. 1, February 1992, pages 26-52, the problem is considered of how to group live blocks of data when they are written out due to free space collection. One possibility considered is to try to enhance the locality of future reads, for example by grouping files in the same directory together into a single output segment. Another possibility is to sort the blocks by the time they were last modified and group blocks of similar age together into new segments. The idea is that tracks last written at around the same time have some temporal affinity, so it should be advantageous to have them together in the same segment.
The results of the locality grouping given in this paper were not very encouraging. This result was due to the form of free space collection algorithm being used in the analysis. A greedy algorithm does not work well with locality grouping as a segment does not get chosen for free space collection or cleaning until it becomes the least utilised of all segments. Thus every segment's utilisation eventually drops to the cleaning threshold, including very slowly changing “cold” segments. Unfortunately, the utilisation drops very slowly in cold segments, so these segments tend to linger just above the cleaning point for a very long time. With locality, many more segments cluster around the cleaning point for a very long time. The overall result is that cold segments tend to tie up large numbers of free blocks for long periods of time.
The above paper also tried using age-grouping with the cost-benefit algorithm with more promising results. In order to sort live blocks by age, the segment summary information records the age of the youngest block written to the segment. A single modified time was kept for the entire file and this estimate would be incorrect for a file not modified in its entirety. The paper suggests that a modification of the segment summary information could be made to include modified times for each block of data.
In “An Age-Threshold Algorithm for Garbage Collection in Log-Structured Arrays and File Systems” J. Menon and L. Stockmeyer, RJ 10120 (91936) May 12, 1998 Computer Science, the possibility of reorganising live tracks collected by the age-threshold free space collection algorithm before packing them into segments is considered. Again the method considered is to group together tracks of similar age i.e. tracks that were last written at around the same time.
There are a number of issues to consider when designing a free space collection algorithm all of which will affect the efficiency of the free space collection process.